Week 10 : ( April. 7, 2017 )
Output Devices
Assignment
In this week, task is to is to use output devices:add an output device to a micro controller board and program it to do something
Examples are:
LED, Lamp, Buzzer, Piezo, Motors, Solenoid, Relay, 7-segment display, etc
The signal output can be from a pin of a Attiny45 chip to activate any of the output device mentioned.
Analog
Analog technology, information is translated into electric pulses of varying amplitude, the signal is a continuous signal which represents physical measurements. The analog signal Waves Denoted by sine waves. Data transmissions time Subjected to deterioration by noise during transmission and write/read cycle. The example of analog is Human voice in the air, analog electronic devices.
Digital
Digital technology, translation of information is into binary format (zero or one) where each bit is representative of two distinct amplitudes. Digital signals are discrete time signals generated by digital modulation. The analog signal waves are Denoted by square waves. The main comparison of digital Can be noise-immune without deterioration during transmission and write/read cycle. The example of digital out is Computers, CDs, DVDs, and other digital electronic devices.
I decided to use an RGB LED
A single LED die can only emit monochromatic light which could be one of three primary colors -red,green and blue is called RGB LED.
➔This weeks assignment, We need to add an output device into any Micro controller board I made. There are various output devices such as LCD display, speaker, RGB LED, servo motor etc. I decided to add a button and an RGB LED to an At-tiny Micro controller and program it in such a way that when I click the button, The LED starts changing its color.
Designing the board
The board was designed/modified yet again in
➔The signal output can be from a pin of a At-tiny 45 chip to activate any of the output device mentioned.
EagleCAD was used to design the circuit. The operating procedure will not be repeated here as it was described in Week 6.
Below are the screen shots of the final input and output board.
➔First I designed the board with Eagle, here you can see the schematic and the board design:
I made the complete schematic and generated corresponding board design as shown below.
I generated the eagle .cmp file for the machine code and I milled the board after completing different stages of making the PCB.
CODE
int redPin = 3;
int greenPin = 10;
int bluePin = 9;
//uncomment this line if using a Common Anode LED
//#define COMMON_ANODE
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop()
{
setColor(255, 0, 0); // red
delay(1000);
setColor(0, 255, 0); // green
delay(1000);
setColor(0, 0, 255); // blue
delay(1000);
}
void setColor(int red, int green, int blue)
{
#ifdef COMMON_ANODE
red = 255 - red;
green = 255 - green;
blue = 255 - blue;
#endif
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}
Result:
My Output week board was got working as per the program I have done in it. The main problem I faced in this was that while the boootloader was burning, there was short circuit in the board. I double checked the board and made ensure that the adjusted traces and soldered parts are separated using precision knife.